package com.dxy.app.act_widget;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.dxy.app.R;

/**
 * Created by dell on 2017/8/22.
 */

public class HidenBottomActivity extends Activity {
  private LinearLayout root;
  @Override protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hiden_bottom);
    root = (LinearLayout) findViewById(R.id.ll_element_root);
    addChild();
  }
  private void addChild(){
    for(int i=0;i<10;i++){
      TextView tv =new TextView(this);
      tv.setText("这是测试块"+i);
      tv.setGravity(Gravity.CENTER);
      tv.setPadding(0,100,0,100);
      tv.setTextSize(20f);
      tv.setTextColor(Color.BLACK);
      tv.setBackgroundColor(Color.GREEN);
      LinearLayout.LayoutParams lps =new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
          ViewGroup.LayoutParams.WRAP_CONTENT);
      root.addView(tv,lps);
    }

    TextView bottom =new TextView(this);
    bottom.setText("这是底部");
    bottom.setBackgroundColor(Color.RED);
    bottom.setGravity(Gravity.CENTER);
    bottom.setTextSize(20f);
    bottom.setPadding(0,100,0,100);
    LinearLayout.LayoutParams lpsBottom =new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.WRAP_CONTENT);
    root.addView(bottom,lpsBottom);
  }
}
